Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make random coin spawn position?

Asked by 5 years ago

Hello,

I have this follow Coin Script:

`currency = "Coins" -- Change Gold to the currency you want to give amnt = 10 -- Change 50 to the amount of money you want to give debounce = false -- Don't change this

function onTouch(hit)
    if hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == false then
        if game.Players:findFirstChild(hit.Parent.Name) ~= nil then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        player.leaderstats:findFirstChild(currency).Value = player.leaderstats:findFirstChild(currency).Value + amnt
        script.Parent.Transparency = 1
        script.Parent.CanCollide = false
        debounce = true
        math.randomseed(tick()) --To make random randomer
        wait(math.random(10,20))
        script.Parent.Transparency = 0
        script.Parent.CanCollide = true
        debounce = false
        end
    end
end

script.Parent.Touched:connect(onTouch)`

but now I want that it random spawn on the map and not on fixed positions. How I can do that?

Thanks a lot!

0
What type of map do you have. It will depend a lot on the type of map because if you have lots of changing terrain, you might have some coins in the air, but if is a flat map, then I can tell you, For a changing terrain map, I would suggest spawning them in the sky and dropping them until they hit something (the ground) so that they can reach all points of the map, yet never spawn underneath. greenhamster1 180 — 5y
0
Hi i have a normal Train but I have some over layers .... So drop from the sky would be very cool... antraxoPOINTcom 0 — 5y
0
do random x and z and make sure there is a limit and if needed so, do y. RetroGalacticGamer 331 — 5y
0
How would that work? antraxoPOINTcom 0 — 5y

Answer this question