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
#Spawn function not working
1 messages · Page 1 of 1 (latest)
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
its mostly definitely not a roblox issue and definitely a scriptissue or how you have things setup
I send script
could we have the scripts and a video of whats going on
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 :/
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
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
failed meaning?
it summoned when it wasnt supposed to
or didnt summon when it was
Both
I encountered both kind of issues
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
** You are now Level 4! **
this script does basiclly nothing
unless theres anothoer script that reliases on the color
of buffer
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
?
what does that mean
It crashes the studio OR server if it is moved out of Workspace, the spawner I mean
Why? No clue
another script probaly needs it and doesnt have debounce
so what are the other scripts
IT didn't let me send
To shrink the spawner so it cannot be touched
I tried but It always breaks
you can change the size without tweens
I dunno if I am braindead but I never managed to get a simple size change to work
can you just send me ur studio file
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