Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

"attempt to index nil with 'PlayerGui' " How do i fix this ?

Im trying to make an story game. (The script is an Normal Script)

local function challenge_1()
	local guide_Image = "rbxassetid://7359283182"
	local plr = game:GetService("Players").LocalPlayer
	local gui = plr.PlayerGui.DarkScreen.Frame.LocalScript
	local work = game:GetService("Workspace")
	local boat = work.Boat
	local tp = work.BoatTeleport
	
	boat.Bottom.Smoke.Enabled = true
	getRandomPlayer()
	CreateDialogueEvent:FireAllClients(getPlayerImage(randomPlayerId),"What is all this smoke ?")
	wait(2)
	boat.Bottom.Fire.Enabled = true
	CreateDialogueEvent:FireAllClients(guide_Image,"FIRE !!!")
	wait(2)
	gui.Disabled = false
	tp.Tp.Script.Disabled = false
	wait(10)
	gui.Disabled = true
	boat:Destroy()
	tp:Destroy()
end

1 answer

✓ Accepted answer

The reason is because you are trying to access the localplayer in a server sided script. You can only access localplayer in a local script.

1 comment

0

thx

This discussion is preserved as it was. New answers, comments, and votes are closed.