This is my punch animation script, i want to make it so when you hit someone it does damage. And the amount of damage you do depends on your stat which i have in leaderstats. For example i want it so someone with 100 strength does more damage than someone with 25 strength, etc. But i can't figure out how to script it out or where to put in.
local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()
local event = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local AnimationId = 5005123017
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://"..AnimationId
local AnimationTrack = Humanoid:LoadAnimation(Animation)
local function PunchAndAddStrength()
if not (AnimationTrack.Stopped) then return end
event:FireServer()
AnimationTrack:Play()
end
I just started really scripting yesterday so most stuff is confusing for me.
local event = game.ReplicatedStorage:WaitForChild("RemoteEvent")
event.OnServerEvent:Connect(function(player)
local Leaderstats = player:WaitForChild("leaderstats")
local Strength = Leaderstats:FindFirstChild("Strength")
if (Strength) then
Strength.Value = (Strength.Value + 1)
end
end)

3 comments
Show the event listener, the problem lies there, not in your local script.
oh ok, i've added it
Theres no problem i just don't know how to write a script that causes damage along with making the damage go up the more strength you have