This TOOL's script works in Roblox Studio but it doesn't work in the real Roblox Place (RobloxBeta) It says that: Players.RomDino.Backpack.Flashlight.ShakeLight:2:attempt to index local 'player' (a nil value)
local player = game.Players.LocalPlayer
local character = player.Character
local hum = character:WaitForChild("Humanoid");
if not character or not character.Parent then
character = player.CharacterAdded:wait()
end
local tool = script.Parent;
local shake1 = tool.Handle:WaitForChild("FirstShake");
local shake2 = tool.Handle:WaitForChild("SecondShake");
local handle = tool:WaitForChild("Handle");
local spotLight = handle:WaitForChild("SpotLight");
local remoteEvent = tool:WaitForChild("RemoteEvent");
remoteEvent.OnServerEvent:Connect(function(player)
if (spotLight.Brightness >= 2) then
spotLight.Brightness = 2
else
local anim_feet = hum:LoadAnimation(script.Parent.Animation)
local current = anim_feet
current:Play()
shake1:Play()
wait(0.15)
shake2:Play()
spotLight.Brightness = spotLight.Brightness + 0.35;
end
end)
If anybody can fix this then thank you

3 comments
is this a local script?
Is this a local script? LocalPlayer only works in LocalScripts which HAVE to be inside the player for it work.
Is there a way I can get the Humanoid Character without using Local Script? Local Script crashes this script!