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

Car Gui dont works how will it work ???The script I got dont works,Gui dont gets cloned and moved

I dont know why this script isnt working.I am new with programming and trying to make an Gui for an car,but bevor I try to add an Value the script it needs to Show up.


`script.Parent.Touched:connect(function(plr)
	game.ServerStorage.ScreenGui:Clone()t=plr.PlayerGui
end)

`

1 answer

✓ Accepted answer

Use this method:


local TestGui = script.Parent[GUI'S NAME]

script.Parent.Touched:Connect(function(t)
	local plr = game.Players:GetPlayerFromCharacter(t.Parent)	-- Creates a new variable contains a player value 
	if plr.Character and plr.PlayerGui:FindFirstChild('TestGui') then	-- This will check if the player is alive and if he has the gui or not
		plr.PlayerGui:FindFirstChild('TestGui'):Destroy()
		TestGui:Clone().Parent = plr.PlayerGui	
		print('Replaced',TestGui.Name)
	else
		TestGui:Clone().Parent = plr.PlayerGui	
		print('Cloned',TestGui.Name)
	end
end)

Make sure the script and the gui are inside the same parent.

If you this is too much for you, just look up at wiki.roblox.com as it has a very useful information for new people like you.

1 comment

0

Thx,I learned in the last 2 Weeks much about Roblox Studio,and this is helping me alot.

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