RomDino
|
  |
| Joined: 04 Jul 2015 |
| Total Posts: 2795 |
|
|
| 23 Jan 2017 05:34 AM |
The Animation and the flashlight runs perfectly in Roblox Studio but when i join the place with the Ro##########his happens: Players.RomDino.Backpack.Flashlight.ShakeLight:2:attempt to index local 'player' (a nil value)
Error at line 2, I couldn't know what to fix. I tried moving it and changed it but it still doesn't work
Here is the full script:
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) |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
| |
|
RomDino
|
  |
| Joined: 04 Jul 2015 |
| Total Posts: 2795 |
|
|
| 23 Jan 2017 06:03 AM |
| I did but it says: Event only use for Server |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 23 Jan 2017 07:42 AM |
Choose one: You can only use RemoteEvent.OnServerEvent from regular (server) scripts You can only use Players.LocalPlayer from localscripts.
I'd recommend using RemoteEvent.OnClientEvent |
|
|
| Report Abuse |
|
|