This script is located in server script storage. I am trying to make this script connect to the tool in the starterpack.
This doesn't work, in game, but it works on studio. And I would ask to someone to tell me the problem ? and the solution.
Please help!
(FE GAME)
SERVER SCRIPT:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local kickEvent = Instance.new("RemoteEvent", ReplicatedStorage)
kickEvent.Name = "kickEvent"
local backpack = game:GetService('StarterPack')
local Tool = backpack.Kick
local function onDumbellActivated(plr)
local char = game.Workspace:FindFirstChild(plr.Name)
local hum = game.Players.LocalPlayer.Character.Humanoid
local anim_feet = hum:LoadAnimation(script.KickAnimation)
local current = anim_feet
current:Play()
wait(0.4)
end
local function onToolEquipped(plr)
local hum = game.Players.LocalPlayer.Character.Humanoid
local anim_feet = hum:LoadAnimation(script.EquippedIdleAnimation)
local current = anim_feet
current:Play()
end
kickEvent.OnServerEvent:Connect(onKickActivated)
kickEvent.OnServerEvent:Connect(onToolEquipped)
2ND SCRIPT (TOOL SCRIPT):
Player = game.Players.LocalPlayer
local Tool = script.Parent
local Plr = game.Players.LocalPlayer
local kickEvent = game.ReplicatedStorage:WaitForChild("kickEvent")
local Used = false
local Activated = game.ReplicatedStorage.Activated
Tool.Activated:connect(function()
kickEvent:FireServer()
if not Used then
Used = true
Activated.Value = true
script.Disabled = true
wait(0.6)
script.Disabled = false
end
end
wait(2)
Used = false
end)

2 comments
Please help, how do you think the game knows what LocalPlayer is? I need help right now.
the 2nd script is localscript