so ive got this on touch script for a tycoon button, but im wanting to make a billboard with brick buttons on it to buy stuff, problem is i dont know how to convert this ontouch button to an on click button and still work using a clickdetector
ive tried a few things tho im very bad at lua so im sure they were very miss when i did but i guess what i got stuck on was the hitpart throughout the script
mind walking me through how to get this converted?
-------------------------------------------------------------------------------------------------------------------------
model = workspace.Part2
Upgradecost = 0
-------------------------------------------------------------------------------------------------------------------------
upgradeStuff = model:clone()
wait(1)
model:remove()
owner = script.Parent.Parent.Parent.OwnerName
local ting = 0
function onTouched(hit)
if ting == 0 then
ting = 1
check = hit.Parent:FindFirstChild("Humanoid")
if check ~= nil then
if hit.Parent.Name == owner.Value then
local user = game.Players:GetPlayerFromCharacter(hit.Parent)
local stats = user:findFirstChild("leaderstats")
if stats ~= nil then
local cash = stats:findFirstChild("Gold")
if cash.Value > (Upgradecost-1) then
cash.Value = cash.Value - Upgradecost
upgradeStuff.Parent = script.Parent.Parent.Parent
script.Parent.Parent:remove()
end
end
end
end
ting = 0
end
end
script.Parent.Touched:connect(onTouched)

1 comment
thanks for the help, and explaining what you did, works perfect now