game.Workspace.EnergyBarShop.EnergyBarShopItem.ClickDetector.MouseClick:Connect(function(plr)

if plr.leaderstats.Money.Value >= 20000 then

plr.leaderstats.Money.Value = plr.leaderstats.Money.Value - 20000

EnergyBar = game.ServerStorage.EnergyBar:Clone()

EnergyBar.Parent = plr.Backpack

end

end)

game.ReplicatedStorage.EnergyBarEffects.OnServerEvent:Connect(function(plr)

local Character = game.Workspace[plr.Name]

Character.Humanoid.Health = Character.Humanoid.Health + 100

Character.Humanoid.WalkSpeed = 21

wait(25)

Character.Humanoid.WalkSpeed = 16

EnergyBar:Destroy()

end)

4 comments

0

It does not look like you ever send the remote event. To me it seems like you should just make the code one long code Instead of having the remote event?

0

We need to know what fires the remote event and when as this could be the problem

0

It does everything else in the script except for that

0

Why are you getting the character like that? You already have 'plr' as it gets passed through a remoteevent by default, just do local Character = plr.Character or plr.CharacterAdded:Wait()