You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I wanna make it so that fireballs fall across the basplate -
What is the issue? Include screenshots / videos if possible!
I am getting this error: invalid argument #2 to ‘random’ (interval is empty)
I am trying to get a random number between a negative number and a positive number -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I did but they were only dealing with postive numbers
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local isInAir = true
local onGround = false
local debounce = false
local ground = workspace.Baseplate
--dimensions of the baseplate
local minX = 47.568
local maxX = -178.151
local minZ = -149.885
local maxZ = 88.1
local rng = Random.new(tick())
script.Parent.Position = Vector3.new(math.random(maxX, minX), script.Parent.Position.Y, math.random(maxZ, minZ)) --errors
script.Parent.Touched:Connect(function(touched)
if not debounce and touched == ground then
debounce = true
onGround = true
isInAir = false
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://" .. 262154437
sound:Play()
sound.Ended:Connect(function() sound:Destroy() end)
end
end)
if onGround and not isInAir then
local explosion = Instance.new("Explosion", workspace)
explosion.BlastPressure = 1200
explosion.BlastRadius = 250
explosion.Position = script.Parent.Position
explosion.Hit:Connect(function(hit, distance)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
hit.Parent:FindFirstChildWhichIsA("Humanoid").Health = 0
if game.Players:GetPlayerFromCharacter(hit.Parent) ~= nil then
game.Players:GetPlayerFromCharacter(hit.Parent):Kick("A fireball crushed you.")
end
end
end)
local crater = game.ServerStorage.Assets.Crater:Clone()
local craterPrimaryPart = crater.PrimaryPart
for i, v in pairs(crater:GetChildren()) do
if v ~= crater.PrimaryPart then
local weld = Instance.new("WeldConstraint")
weld.Part0 = v
weld.Part1 = craterPrimaryPart
end
end
craterPrimaryPart.Position = script.Parent.Position
crater.Parent = workspace
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.