Okay so this script works fine when I go to test > play solo, but when I click play the game in server mode, the script doesn't do anything... Help?
player=script.Parent.Parent.Parent char=player.Character mouse=player:GetMouse() dance_sound = Instance.new("Sound", char.head) dance_sound.Name = "dance_sound" dance_sound.Volume = 1 dance_sound.Looped = true local dancestat = false local danceanim = Instance.new("Animation", char) danceanim.Name = "dance_anim" mouse.KeyDown:connect(function(key) local key=key:lower() if key=="e" then danceanim.AnimationId = script.Parent.dance_anim.Value local vCharacter = char local hum = vCharacter:findFirstChild("Humanoid") playanim = hum:LoadAnimation(char.dance_anim) playanim:Play() end end) mouse.KeyUp:connect(function(key) local key=key:lower() if key=="e" then playanim:Stop() end end) mouse.KeyDown:connect(function(key) local key=key:lower() if key=="e" then dance_sound.SoundId = script.Parent.dance_sound.Value dancestat = true dance_sound:Play() end end) mouse.KeyUp:connect(function(key) local key=key:lower() if key=="e" then dancestat = false dance_sound:Stop() end end)
On line 01, insert this code to let the script wait until the player is rendered:
repeat wait(.5) until game.Players.LocalPlayer ~= nil