What he just said is basic scripting knowledge, if you dont know that much please dont ask for help. Nobody will be able to help if you cant help yourself.
local touchPart = script.Parent
--You need a leaderstats for the currency and for this script to work properly...
touchPart.Touched:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
local currency = player.leaderstats.coins
if currency >= 100 then
print("Yay, enough coins!")
--do whatever if player has more than or equal to 100 coins(optional
else
print("Player doesn't have enough coins")
--If not then do what ever here..
end
end)
Basically use this script, you will understand it eventually as you look at it
the thing is once i have it i get how it works
In the currency variable itās referring to coins so you can just change that up as it was an example I madeā¦
Why do you post screenshots when I told you to post it as text here formatted by ``` surrounding the block of code. If you expect people to help, you should follow forum etiquette. Posting screenshots is a pain because you may need multiple screenshots to cover the entire script while posting it as text prevents that and also makes it easier to read. We also can then quote it and add things to it to fix it. This will be my last message about it and Iām sorry if Iām sounding like a mini boss but everyone else doesnāt post screenshots of code in this forum.
oke i will do that from now on
@rohanspeeltgames Watch this tutorial video if you are still unsureā¦
The tutorial video uses a click event for the part instead of touchā¦other than that it makes sense and will most likely help you!
but how do i get the script for money that starts with 1 to 0
i think i need to remake the full leaderstats script
Are you a beginner at scripting on roblox?
I suggest you watch some youtube tutorials and read the developer documentation pageā¦
okay thanks but i am on a time limit
i have 16 hours to fix the leaderstats and make the teleporter work
In your script you called p
instead of the player
variable I madeā¦
i changed it to player but the script still does not work
can the currency be lower than 100 on the script
The amount of currency required to teleport the player can be changed, it is obivous by now that you could easily change it to a different value.
You might wanna do some research to questions you are wondering and ask after being unable to solve it through research or tutorialsā¦
this is the script i have now the arnt any mistakes right
local Teleport_To_This_Tag = ā0004ā ā This is the Tag thing you find in the teleporter bricks. The brick with the tag that matches this is the brick you will tele to once you touch this one.
function findTele(tag)
local tele = nil
function scan(p)
for _,v in pairs(p:GetChildren()) do
if ((v.Name == āTelepadā) and (v:findFirstChild(āTagā))) then
if (v.Tag.Value == tag) then tele = v break end
end
if (#v:GetChildren() > 0) then scan(v) end
end
end
scan(game:service(āWorkspaceā))
return tele
end
script.Parent.Touched:connect(function(h)
local touchPart = script.Parent
āYou need a leaderstats for the currency and for this script to work properlyā¦
touchPart.Touched:Connect(function(hit)
local player = game:GetService(āPlayersā):GetPlayerFromCharacter(hit.Parent)
local currency = player.leaderstats.Multi
if currency >= 1 then
ādo whatever if player has more than or equal to 100 coins(optional
player.Character:MoveTo(tele.CFrame.player+Vector3.new(0,0,0))
local t = Instance.new(āWeldā)
t.Name = āJustTeleportedā
t.Parent = player
delay(1.5,function() t:remove() end)
end
end)
If itās really that hard for you, I will create a game of it which you are able to editā¦
Give me 10-15 minsā¦