#Spawn function not working

1 messages · Page 1 of 1 (latest)

tulip wagon
#

MY spawner uses a script that checks for a player(who stepped on it)'s money then if they have enough AND the spawnbox is not occupied by another vehicle, they get to spawn it. However I couldn't get the second part to work.
As a workaround the detector has it's own script that only makes the spawn button show up if nothing touches the detector, the issue the detector sometimes falsely detects collision or ignores one for seemingly no reason, and once it breaks it softlocks the spawnpoint, for a while I ignored it because it only broke less than 2% of the time, but I finally came around to try to tackle it

#

I very much feel like it is a Roblox issue and not a script issue, because it only fails when Roblox lags or some glitchy behaviour occurs

tame aspen
tulip wagon
#

I send script

tame aspen
#

could we have the scripts and a video of whats going on

tulip wagon
#

local TweenService = game:GetService("TweenService")

local part = script.Parent
local touchCount = 0
local Spawner = script.Parent.Parent.Head

local SpawnerSize = Spawner.Size
local OriginalSize = SpawnerSize
local newSpawnerSize = Vector3.new(0.1,0.1,0.1)

local ResizetweenInfo = TweenInfo.new(
1, -- Duration in seconds (adjust as needed)
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out
)

local Sizingtween = TweenService:Create(Spawner, ResizetweenInfo, {Size = newSpawnerSize})
local UnSizingtween = TweenService:Create(Spawner, ResizetweenInfo, {Size = OriginalSize})

local part = script.Parent

local function updateColor()
if touchCount > 0 then
part.BrickColor = BrickColor.new("Lime green")
Sizingtween:Play()
else
part.BrickColor = BrickColor.new("Really red")
UnSizingtween:Play()
end
end

part.Touched:Connect(function(otherPart)
touchCount = touchCount + 1
updateColor()
end)

part.TouchEnded:Connect(function(otherPart)
if touchCount > 0 then
touchCount = touchCount - 1
end
updateColor()
end)

-- Set initial color
updateColor()

local part = script.Parent
local TweenService = game:GetService("TweenService")

#

Here is the buffer's script that makes the Spawner (Head)) Dissapear

#

Though maybe the issue is I modified something someone else made, because I couldn't make a spawner by myself

#

I don't undestrand most of the code :/

tame aspen
#
local TweenService = game:GetService("TweenService")

local part = script.Parent
local touchCount = 0
local Spawner = script.Parent.Parent.Head

local SpawnerSize = Spawner.Size
local OriginalSize = SpawnerSize
local newSpawnerSize = Vector3.new(0.1,0.1,0.1)


local ResizetweenInfo = TweenInfo.new(
    1, -- Duration in seconds (adjust as needed)
    Enum.EasingStyle.Sine,
    Enum.EasingDirection.Out
)

local Sizingtween = TweenService:Create(Spawner, ResizetweenInfo, {Size = newSpawnerSize})
local UnSizingtween = TweenService:Create(Spawner, ResizetweenInfo, {Size = OriginalSize})

local part = script.Parent

local function updateColor()
    if touchCount > 0 then
        part.BrickColor = BrickColor.new("Lime green")
        Sizingtween:Play()
    else
        part.BrickColor = BrickColor.new("Really red")
        UnSizingtween:Play()
    end
end

part.Touched:Connect(function(otherPart)
    touchCount = touchCount + 1
    updateColor()
end)

part.TouchEnded:Connect(function(otherPart)
    if touchCount > 0 then
        touchCount = touchCount - 1
    end
    updateColor()
end)

-- Set initial color
updateColor()

ignore this

this is just for my viewing experience

tulip wagon
#

Basically IF I undestand what I made correctly:
It sums up collisions and subratcts every time one ends

#

except it fails every once in a while

#

whenever it feels like it

#

and once it does, it is softlocked

#

This script is a workaround, because originally I wanted to include this with the spawner's script

tame aspen
tulip wagon
#

Most of the time it works though

#

The issue isn't even it rarely breaking, but the fact that if it does, it stays broken

hexed sparrowBOT
#

studio** You are now Level 4! **studio

tame aspen
#

unless theres anothoer script that reliases on the color

#

of buffer

tulip wagon
#

There is a tween

#

Basically the spawner is shrunk so it couldn't be touched

#

That was the workaround because the spawner REALLY doesn't like being removed from workspace

tulip wagon
#

It crashes the studio OR server if it is moved out of Workspace, the spawner I mean

#

Why? No clue

tame aspen
#

so what are the other scripts

tulip wagon
#

IT didn't let me send

tame aspen
#

also why are you tweening

#

just set the size

tulip wagon
#

To shrink the spawner so it cannot be touched

tulip wagon
tame aspen
tulip wagon
#

I dunno if I am braindead but I never managed to get a simple size change to work

tame aspen
#

can you just send me ur studio file

tulip wagon
#

Sure

#

1 moment

#

Here it is

#

I would go ballistic if by some miracle it just works for you flawlessly
Because knowing my logic, it very well could do that
Then I would look like either a liar or an idiot, or both

#

It is terribly optimized btw, because I have no idea how to do that at all