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

droppers spawn before player touches buy dropper button????

Asked by 7 years ago
Edited 7 years ago

im working on a tycoon game and for some reason the droppers are spawning before you own the tycoon or anything this is the link if you wanna see the error

https://www.roblox.com/games/214418744/slenderman-tycoon-v-0-0-1-beta

heres the dropper script

wait(2)
workspace:WaitForChild("PartStorage")

while true do
    wait(1.5) -- How long in between drops
    local part = Instance.new("Part",workspace.PartStorage)
    part.BrickColor=script.Parent.Parent.Parent.DropColor.Value
    part.Material=script.Parent.Parent.Parent.MaterialValue.Value
    local cash = Instance.new("IntValue",part)
    cash.Name = "Cash"
    cash.Value = 5 -- How much the drops are worth
    part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.4,0)
    part.FormFactor = "Custom"
    part.Size=Vector3.new(1.2, 1.2, 1.2) -- Size of the drops
    part.TopSurface = "Smooth"
    part.BottomSurface = "Smooth"
    game.Debris:AddItem(part,20) -- How long until the drops expire
end

I have no script for the button because I have my scripts based off zednovs

2 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

I don't use free models, but I'm going to try my best helping u. Make it so when you touch the tycoon gate or whatever to claim it, make a value for that. And put this script in the gate thingy. And in the gate model insert a BoolValue and name the value Owned

local NotTouchedYet = false --debounce
function onTouch(hit)
    if NotTouchedYet == false and hit.Parent:FindFirstChilc("Humanoid") then -- checks if it is a player and the debounce is true
        local NotTouchedYet = true
        script.Parent.Owned.Value = true
    end
end

There, now for your script. So this is your final product.

wait(2)
workspace:WaitForChild("PartStorage")
local GateValue = --go to the place where the Owned value is

while GateValue.Value == true and wait(1.5) do --Checks if it is owned and makes the wait here, making the script shorter.
    local part = Instance.new("Part",workspace.PartStorage)
    part.BrickColor=script.Parent.Parent.Parent.DropColor.Value
    part.Material=script.Parent.Parent.Parent.MaterialValue.Value
    local cash = Instance.new("IntValue",part)
    cash.Name = "Cash"
    cash.Value = 5 -- How much the drops are worth
    part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.4,0)
    part.FormFactor = "Custom"
    part.Size=Vector3.new(1.2, 1.2, 1.2) -- Size of the drops
    part.TopSurface = "Smooth"
    part.BottomSurface = "Smooth"
    game.Debris:AddItem(part,20) -- How long until the drops expire
end

Also, don't just paste this in and let the magic happen, follow the comments and other instructions!

0
And, I highly unrecommend just inserting free models and just saying "Oh, thats my game!" No NO dont do that! SH_Helper 61 — 7y
0
@SH_Helper The use of freemodels is not completely evil contrary to popular belief. Believe it or not some of the top developers on ROBLOX started with freemodels. They learned to program by looking at freemodels. As have I. Heck, even members of stylis studios have use freemodels to start. AZDev 590 — 7y
0
@AZDev free models for learning is fine- copying someone elses work and calling it your game is not. also most free models are malicous Volodymyr2004 293 — 7y
0
What i mean is dont put down a hundred trees and observation towers and call that a proper game. SH_Helper 61 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

Is the dropper in the PurchasedObjects model or Objects model it needs to be in one of those. If you would like shoot me a friend request and enable team create.

Answer this question