- What do you want to achieve? Keep it simple and clear!
A money printer.
- What is the issue? Include screenshots / videos if possible!
ProximityPrompts not being triggered
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried switching from Triggered to TriggerEnded cause of hold duration, I tried to switch the hold duration from 2 to 0 and none of them worked. I tried to look for solutions, but didn’t find any.
local valuesfolder = script.Parent.Values
local maxcashval = 100000
local ownerval = valuesfolder.Owner
local cashval = valuesfolder.Cash
local Printing = valuesfolder.Printing
local waittime = valuesfolder.Time
local printedcash = valuesfolder.PrintedCash
local enabled = valuesfolder.Enabled
local soundsfolder = script.Parent.Sounds
local buttonsound = soundsfolder.Button
local printedsound = soundsfolder.Printed
local button = script.Parent.Button
local buttonpressed = script.Parent.ButtonPressed
local function onAnchestryChanged(child, parent)
if parent.Name == "playerPlaced" then
Printing.Value = true
enabled.Value = false
else
Printing.Value = false
enabled.Value = false
end
end
script.Parent.AncestryChanged:Connect(onAnchestryChanged)
while task.wait(waittime.Value) and Printing.Value == true and enabled.Value == true do
if cashval.Value < maxcashval then
printedsound:Play()
cashval.Value += printedcash.Value
end
end
local function changecashtext(NewVal)
script.Parent.Text.SurfaceGui.TextLabel.Text = "$".. NewVal
end
cashval.Changed:Connect(changecashtext)
local startstopproximity = script.Parent.Button.Prompt
startstopproximity.Triggered:Connect(function(plr)
if plr.Character.Name == ownerval.Value and enabled.Value == false then
buttonsound:Play()
button.Transparency = 1
buttonpressed.Transparency = 0
task.wait(.5)
button.Transparency = 0
buttonpressed.Transparency = 1
startstopproximity.ObjectText = "Stop"
enabled.Value = true
else
if plr.Character.Name == ownerval.Value and enabled.Value == true then
buttonsound:Play()
button.Transparency = 1
buttonpressed.Transparency = 0
task.wait(.5)
button.Transparency = 0
buttonpressed.Transparency = 1
startstopproximity.ObjectText = "Start"
enabled.Value = false
else
if plr.Character.Name ~= ownerval.Value then
return
end
end
end
end)
local withdrawproximity = script.Parent.Text.ProximityPrompt
withdrawproximity.Triggered:Connect(function(plr)
if plr.Character.Name == ownerval.Value then
plr:WaitForChild("PlayerStats").Cash.Value += cashval.Value
cashval.Value = 0
end
end)
The money printer model is cloned and named player_moneyprinter then placed into the folder in workspace called “playerCreated”, from there only the player that placed it can interact with it.