what i want: if i clicked 100 proximity prompt will show and once you press e the border will be destroyed (ik i have to add debounce because autoclickers exist ill add it in later)
script:
local Players = game:GetService("Players")
local client = Players.LocalPlayer
client.PlayerGui.ScreenGui.TextButton.MouseButton1Click:Connect(function(hit)
local prop = game.Workspace.Part.ProximityPrompt
prop.Parent = game.Workspace.Part
prop.Enabled = false
local playerPoints = client.leaderstats.gold
playerPoints.Value = playerPoints.Value + 1
if playerPoints.Value >= 100 then
prop.Enabled = true
if prop.Triggered == true then
prop.Parent:Destroy()
end
end
end)
the main area im having problems with is here:
if prop.Triggered == true then
prop.Parent:Destroy()
end
also local script is in a textbutton in startergui
and proximity prompt in a part
Outside of the function all you need to do is the following.
prop.Triggered:Connect(function(player)
--do stuff here
end)
Somewhere after “prop” has been declared.
local Players = game:GetService("Players")
local client = Players.LocalPlayer
local prop = game.Workspace.Part.ProximityPrompt
prop.Triggered:Connect(function(player)
--here
end)
client.PlayerGui.ScreenGui.TextButton.MouseButton1Click:Connect(function(hit)
prop.Parent = game.Workspace.Part
prop.Enabled = false
local playerPoints = client.leaderstats.gold
playerPoints.Value = playerPoints.Value + 1
if playerPoints.Value >= 100 then
prop.Enabled = true
if prop.Triggered == true then
prop.Parent:Destroy()
end
end
end)
Also the “MouseButton1Click” event isn’t passed any argument so the received parameter named “hit” can be removed as it doesn’t represent any value (is nil).