Hi I'm a basic scripter and I've tried writing this so that it would add a Gui to a player if they're near the part but I don't know how to make it activate. Thanks
Gui = script.menugui
for i, v in pairs(game.Players:GetChildren()) do
if v.Character ~= nil then
if v.Character:FindFirstChild("HumanoidRootPart") ~= nil and (script.Parent.Position - v.Character.HumanoidRootPart.Position).magnitude <= 10 and v.PlayerGui:FindFirstChild(Gui) == nil then
Gui:Clone().Parent = v.PlayerGui
elseif v.Character:FindFirstChild("HumanoidRootPart") ~= nil and (script.Parent.Position - v.Character.HumanoidRootPart.Position).magnitude > 10 then
if v.PlayerGui:FindFirstChild(Gui) then
v.PlayerGui[Gui]:Destroy()
end
end
end
end

1 comment
dsa