Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Minor bug fixes and changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pluviolithic committed Dec 14, 2023
1 parent b39e80c commit 0bc46f8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 33 deletions.
5 changes: 3 additions & 2 deletions src/client/ChatModifiersHandler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ local Remotes = require(ReplicatedStorage.Common.Remotes)
local selectors = require(ReplicatedStorage.Common.State.selectors)
local store = require(StarterPlayer.StarterPlayerScripts.Client.State.Store)

local random = Random.new()
local player = Players.LocalPlayer
local tips = {
"Don't forget to open and evolve pets for more fear!",
"Fight weaker enemies for easy gems!",
"Missions and bosses are the best way to get gems!",
"Remember to buy weapons to do more damage!",
"Stronger areas give more strength when you workout!",
"You can wait 2 minutes to reset your fear meter while scared!",
"Deal more damage by buying stronger weapons!",
Expand Down Expand Up @@ -42,8 +42,9 @@ Remotes.Client:Get("LegendaryUnboxed"):Connect(function(playerName, petName)
end)

task.delay(120, function()
for _, tip in tips do
while #tips > 0 do
if selectors.getSetting(store:getState(), player.Name, "Tips") then
local tip = table.remove(tips, random:NextInteger(1, #tips))
TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(
`<font color= 'rgb(255, 255, 255)'>Tip: {tip}</font>`
)
Expand Down
3 changes: 3 additions & 0 deletions src/client/Jumpscare.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ local function jumpscarePlayer(enemyName)
task.wait(sound.Duration.Value)
sound:Stop()
end
if sound.IsPlaying then
sound.Ended:Wait()
end
sound.TimePosition = timePosition
end)
end
Expand Down
13 changes: 5 additions & 8 deletions src/server/Combat/Enemies/ApplyDamageToEnemy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ return function(player, enemy, info, janitor)
oldEquippedWeaponAccessory:Destroy()
end

local oldEquippedWeaponModel = findFirstChildWithTag(player.Character, "WeaponModel")
if oldEquippedWeaponModel then
oldEquippedWeaponModel:Destroy()
end

if weaponName ~= "Fists" then
local weaponAccessory = weapons[weaponName]:Clone()
player.Character.Humanoid:AddAccessory(weaponAccessory)
Expand All @@ -80,9 +75,6 @@ return function(player, enemy, info, janitor)
return
end
task.delay(1, function()
if selectors.getCurrentTarget(store:getState(), player.Name) then
return
end
weaponAccessory:Destroy()
if not findFirstChildWithTag(player.Character, "WeaponAccessory") then
player.Character.Humanoid:AddAccessory(equippedWeaponAccessory:Clone())
Expand All @@ -105,6 +97,11 @@ return function(player, enemy, info, janitor)
break
end

oldEquippedWeaponAccessory = findFirstChildWithTag(player.Character, "WeaponAccessory")
if oldEquippedWeaponAccessory then
oldEquippedWeaponAccessory:Destroy()
end

task.spawn(function()
local damageIndicator = damageIndicatorTemplate:Clone()
local tween = TweenService:Create(damageIndicator.Amount, TweenInfo.new(0.5), { TextTransparency = 1 })
Expand Down
23 changes: 0 additions & 23 deletions src/server/Combat/Enemies/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,6 @@ local function orientEnemy(rootPart, playerPosition)
)
end

local function findFirstChildWithTag(parent: Instance?, tag: string, recursive: boolean?): Instance?
if not parent then
return nil
end
for _, child in parent:GetChildren() do
if CollectionService:HasTag(child, tag) then
return child
end
if recursive then
local result = findFirstChildWithTag(child, tag, recursive)
if result then
return result
end
end
end
return nil
end

local function handleEnemy(enemy)
local info = {
HealthValue = enemy.Configuration.FearHealth,
Expand Down Expand Up @@ -215,11 +197,6 @@ local function handleEnemy(enemy)

humanoid:MoveTo(enemy.Hitbox.Position + (humanoid.RootPart.Position - enemy.Hitbox.Position).Unit * fightRange)

local oldEquippedWeaponModel = findFirstChildWithTag(player.Character, "WeaponModel")
if oldEquippedWeaponModel then
oldEquippedWeaponModel:Destroy()
end

playerJanitor:Add(
store.changed:connect(function(newState)
if
Expand Down

0 comments on commit 0bc46f8

Please sign in to comment.