Answered by
5 years ago Edited 5 years ago
Yes, that is the really cause. You'll need to use RemoteEvents
and an event listener.
First off, you'll need to insert a RemoteEvent
in ReplicatedStorage and don't name it. That being done, you'll need to fire the RemoteEvent
in the ReplicatedStorage through your local script.
The local script:
01 | local Player = game:GetService( "Players" ).LocalPlayer |
02 | local Mouse = Player:GetMouse() |
04 | local Character = Player.Character or Player.CharacterAdded:Wait() |
05 | local Humanoid = Character:WaitForChild( "Humanoid" ) |
07 | local AnimationId = 5005123017 |
09 | local Animation = Instance.new( "Animation" ) |
12 | local AnimationTrack = Humanoid:LoadAnimation(Animation) |
14 | local function PunchAndAddStrength() |
15 | if not (AnimationTrack.Stopped) then return end |
17 | game.ReplicatedStorage.RemoteEvent:FireServer() |
20 | Mouse.Button 1 Down:Connect(PunchAndAddStrength) |
Now, insert a script into ServerScriptService
and it would be as follows:
1 | game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect( function (player) |
2 | player.leaderstats.Strength.Value = player.leaderstats.Strength.Value + 1 |
Please make sure to upvote this question and select this as your answer if it helped!