MouseButton1Down is not a valid member of Textbox.
add text button, not textbox, the textbox is completely different.
Your distance variable shouldn’t belong in the Variables, instead put the variable in the function.
local GUI = script.Parent
local open = GUI.FrameOpen:WaitForChild("OpenButton")
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Root = Character:FindFirstChild("HumanoidRootPart")
local PressE = game.Workspace:FindFirstChild("PressE")
open.MouseButton1Click:Connect(function()
local Distance = (Root.Position - PressE.Position).Magnitude
print ("Distance")
if Distance < 15 then
print("Distance is less than 15!")
Player.PlayerGui.OpenGui:WaitForChild("Frame").Visible = true
end
end)
possibly because it’s a loop in a function or somthing.
Thanks, where should I put the local script?
Parent it just under the screenGui ‘OpenGUI’
An infinite yield possible on Players.MegaTheMagnificent.PlayerGui.OpenGui.FrameOpen:WaitForChild(“OpenButton”)
HOLD UP. The OpenGui in the script needs renaming OpenGUI aswell
Player.PlayerGui.OpenGUI:WaitForChild("Frame").Visible = true
That’s because the OpenButton is named ‘Open’ not ‘OpenButton’
it will error a warning An infinite possible yield because in the variable it’s trying to find the button but cannot because the textbutton is named differently
For some reason, it doesn’t work I’m honestly so confused at this point. I did everything you told me, I’ll show you screenshots in a sec.
i haven’t tested the code myself I’ll get this done alright now?
I’m confused what are you trying to say?
Because I haven’t tested the script. I will test it until it’s right ok?
so you can have
Oh okay! Just make sure you have a part because of the magnitude, also tell me if you forgot anything.
By the way that photo was a reference, anyway I’m trying to just open the “shop”. Which would be the text button.
I’m confused. If the textbutton in the shop was not visible then you can’t click on that textbutton to open the shop
to make everything easier. If a player was near a part then the button will become visible for the shop right?
Hold on I’ll show u a visual. Oof.
Yes that’d be good if it was like that.