Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Script spawns wrong model, and dosent spawn at the position i want why?

So, I when you click select on the gui then the script changes a value in the player that is called 'Box' so the value is at "Standard" when you first join the server or u dont have any other box selected. It is meant to clone the model that you have selected to your player's torso and set the position to the player's torso but it dosent do that why?. And it dosent spawn the right model that it should the value and the boxes are named the same so. One of the boxes name are "RacerBox" so when the box value is at "RacerBox" then it should spawn that box when the round starts but it dosent do that anymore why? and i get no errors

StatsOnJoinScript:

function SpawnBoxes(tab)
	local map = workspace:FindFirstChild("Map")
	for i,v in pairs(tab) do
		local BoxOfChoise = v.Box.Value
		if v.Character:FindFirstChild(BoxOfChoise) == nil then
			--game.ReplicatedStorage.Boxes:FindFirstChild(BoxOfChoise):Clone().Parent = v.Character
			local box = game.ReplicatedStorage.Boxes:FindFirstChild(BoxOfChoise):Clone() 
			box.Parent = v.Character
			wait(0.5)
			box:MoveTo(map.StartPoints["Start"..i])
		end
	end
end
	
script.SpawnBoxes.Event:connect(function(tab) 
	SpawnBoxes(tab) 	
end)

This is the script that calls the "StatsOnJoinScript"

game.ServerScriptService.StatsOnJoin.SpawnBoxes:Fire(playersInRound)

The scripts are located at "ServerScriptService"

1 answer

Event:Connect() is not a thing. Event.OnServerEvent:Connect() is.

:Fire() is not a thing. :FireServer() is.

Have you ever heard of the Output window? it's where all your print() warn() assert() and errors show up.

2 comments

0

That just broke the script, and you didint tell me why the models didint spawn at the spawn points in the map

0

Well i thought that it didn't work because of those 2 errors..

This discussion is preserved as it was. New answers, comments, and votes are closed.