I want this script to work on a person. I am trying to make a script that if you touch this block you get the GUI. This is in a part.
local part = script.Parent local function steppedOn(part) local parent = part.Parent if game.Players:GetPlayerFromCharacter(parent) then local testing = parent.Name local test = game.Players.testing local c = game.Workspace.Sounds:Clone() c.Parent = test.PlayerGui end end part.Touched:connect (steppedOn)
Its simple, so this script is the child of the part,
local gui = script.gui--change to the location of the gui function touch(hit) if hit.Parent then local playergui = hit:FindFirstChild("PlayerGui") local newgui = gui:Clone()--clones the gui newgui.Parent = playergui print("Complete!")--remove this if you want end end script.Parent.Touched:connect(hit)-- connects the function
so that was simple..
but this is what was wrong with your script
local part = script.Parent local function steppedOn(part) local parent = part.Parent--not needed if game.Players:GetPlayerFromCharacter(parent) then--not needed local testing = parent.Name--parent should be part local test = game.Players.testing local c = game.Workspace.Sounds:Clone()--sounds? i thought it was a gui c.Parent = test.PlayerGui--again should be part end end part.Touched:connect (steppedOn)
No Problem.