Interaction does not make GUI appear

Hello everyone! I am currently scripting a car system for my game Fort Jackson. For some reason, when I interact with the proximityprompt it does not make the GUI appear.

Script:

local player = game.Players.LocalPlayer

script.Parent.ProximityPrompt.Triggered:Connect(function()
	if player:IsInGroup(13312052) then
		game.StarterGui.Spawner.Enabled = true
		print("Player "..player.Name.." has spawned a car.")
	else
		print("Player has no access to spawn a car.")
		script.Parent.ProximityPrompt.ObjectText = "You do not have access to spawn a car."
	end
end)

Workspace set:
image

Video:
robloxapp-20220302-1522047.wmv (521.0 KB)

Before you say if I am in the group, yes I am in the group and it does not print anything, no error, nothing.

Help would be appreciated!

Remove:

local player = game.Players.LocalPlayer

And add player paramter in the triggered event

for more info: ProximityPrompt.Triggered

solve:

script.Parent.ProximityPrompt.Triggered:Connect(function(player)
	if player:IsInGroup(13312052) then
		game.StarterGui.Spawner.Enabled = true
		print("Player "..player.Name.." has spawned a car.")
	else
		print("Player has no access to spawn a car.")
		script.Parent.ProximityPrompt.ObjectText = "You do not have access to spawn a car."
	end
end)
1 Like

I removed the local player and added the player into the function place, it still doesn’t work. This is how my script looks like now:

script.Parent.ProximityPrompt.Triggered:Connect(function(player)
	if player:IsInGroup(13312052) then
		game.StarterGui.Spawner.Enabled = true
		print("Player "..player.Name.." has spawned a car.")
	else
		print("Player has no access to spawn a car.")
		script.Parent.ProximityPrompt.ObjectText = "You do not have access to spawn a car."
	end
end)
1 Like

I believe you would have to change this to:
player.PlayerGui.Spawner.Enabled=true

1 Like

well, if this is serverscript then do:

player.PlayerGui.Spawner.Enabled = true

if it’s localplayer inside the startergui script just keep it like that and maybe the problem doesn’t relate the script if it’s in this case.

1 Like

change the localscript to serverscript

2 Likes

It’s a localscript that is in a part within a model that is in workspace. And it doesn’t work. I’ll try changing it to a serverscript.

yes

1 Like