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 8 years ago
Edited 8 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

01wait(2)
02workspace:WaitForChild("PartStorage")
03 
04while true do
05    wait(1.5) -- How long in between drops
06    local part = Instance.new("Part",workspace.PartStorage)
07    part.BrickColor=script.Parent.Parent.Parent.DropColor.Value
08    part.Material=script.Parent.Parent.Parent.MaterialValue.Value
09    local cash = Instance.new("IntValue",part)
10    cash.Name = "Cash"
11    cash.Value = 5 -- How much the drops are worth
12    part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.4,0)
13    part.FormFactor = "Custom"
14    part.Size=Vector3.new(1.2, 1.2, 1.2) -- Size of the drops
15    part.TopSurface = "Smooth"
16    part.BottomSurface = "Smooth"
17    game.Debris:AddItem(part,20) -- How long until the drops expire
18end

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

2 answers

Log in to vote
0
Answered by 8 years ago
Edited 8 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

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

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

01wait(2)
02workspace:WaitForChild("PartStorage")
03local GateValue = --go to the place where the Owned value is
04 
05while GateValue.Value == true and wait(1.5) do --Checks if it is owned and makes the wait here, making the script shorter.
06    local part = Instance.new("Part",workspace.PartStorage)
07    part.BrickColor=script.Parent.Parent.Parent.DropColor.Value
08    part.Material=script.Parent.Parent.Parent.MaterialValue.Value
09    local cash = Instance.new("IntValue",part)
10    cash.Name = "Cash"
11    cash.Value = 5 -- How much the drops are worth
12    part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.4,0)
13    part.FormFactor = "Custom"
14    part.Size=Vector3.new(1.2, 1.2, 1.2) -- Size of the drops
15    part.TopSurface = "Smooth"
16    part.BottomSurface = "Smooth"
17    game.Debris:AddItem(part,20) -- How long until the drops expire
18end

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 — 8y
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 — 8y
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 — 8y
0
What i mean is dont put down a hundred trees and observation towers and call that a proper game. SH_Helper 61 — 8y
Ad
Log in to vote
0
Answered by 8 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