Im making gui for my Dealership for my gaem by tutorial, i made all things the gui by tutorial then it comes on the test in the video it works all good but in mine studio not the gui, i cant close it the button just dont work im begginer in studio so i will put here the whole script , maybe someone will find the problem

LocalScript ,,Open,,

local Detector = game.Workspace.Dealership.Detector local CloseDistance = math.max(Detector.Size.X, Detector.Size.Z) local CloseButton = script.Parent.Close

?Detector.Touched:Connect(function(hit) if game.Players:GetPlayerFromCharacter(hit.Parent) == game.Players.LocalPlayer then script.ParentEnabled = true end end)

CloseButton.MouseButton1Down:Connect(function() script.Parent.Enabled = false end)

while true do wait() if game.Players.LocalPlayer.Character then local HumanoidRootPart = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart") local mag = (HumanoidRootPart.Position-Detector.Position).Magnitude if mag >= CloseDistance + math.max(HumanoidRootPart.Size.X, HumanoidRootPart.Size.Z) and script.Parent.Enabled == true then script.Parent.Enabled = false end end end

2 comments

0

Try setting a custom number instead of "CloseDistance + math.max(HumanoidRootPart.Size.X, HumanoidRootPart.Size.Z)."

0

well thanks for commenting but idk how to do dat i mean what numbers put there im like beginner in scritping