@Derpee_Kirbee it is. At the PlayerAdded Function, it is defined right here V
Players.PlayerAdded:Connect(function( -->Defined Right Here--> player))
Check this out
this may work
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local soundNames = {
"Running",
"Died",
"Climbing",
"FreeFalling",
"GettingUp",
"Jumping",
"Landing",
"Splash",
"Swimming"
}
local function changeSounds (usedSounds)
print("Remote Event Fired. Setting IDs...")
print(usedSounds[1])
print(player.Name)
print(character.Name)
print(usedSounds[1])
for i = 1, #soundNames do
if type(usedSounds[i]) == "number" and usedSounds[i] ~= 0 then
humanoidRootPart:WaitForChild(soundNames[i]).SoundId = "rbxassetid://" .. tostring(usedSounds[i])
end
end
end
remoteEvent.OnClientEvent:Connect(changeSounds)
to be sure, you can add a wait(5)
before firing the remote event in your server script
wait(5)
remoteEvent:FireClient(player, usedSounds)
Why else, your server script will run before your client script runs