Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

What is wrong with this script? The remote event keeps making a part with a size of 1, 0.0001, 1.

Asked by 2 years ago
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local remoteEvent = ReplicatedStorage:WaitForChild("SpawnWood")

-- Create a new part
local function onStartSpawn(Owner, Type, Length)
    local Len = tostring(Length)
    local NewWood = game.ReplicatedStorage.Wood.Generic:Clone()
    NewWood.Name="Plank"
    NewWood.Parent=game.Workspace.PlayerModels
    NewWood.Owner.Value=Owner
    NewWood.Owner.OwnerString.Value=tostring(Owner)
    NewWood.WoodSection.Size = Vector3.new(1, 100, 1)
    NewWood.WoodSection.Position=game.Workspace:FindFirstChild(tostring(Owner)).Head.Position + Vector3.new(0, 5, 0)
end

-- Call "onCreatePart()" when the client fires the remote event
remoteEvent.OnServerEvent:Connect(onStartSpawn)

When I execute the following code, it makes a part with the size 1, 0.0001, 1

game.ReplicatedStorage.SpawnWood:FireServer("HPermCuber", "Generic", 10)
0
Try changing line 18 from onStartSpawn to onStartSpawn() since its a function. co_existance 141 — 2y
0
@co_existance :Connect requires function object, by calling it you are going to pass whatever onStartSpawn returns into :Connect imKirda 4491 — 2y
0
This most likely happens because NewWood's default size before getting :Cloned is 0.0001 on Y axis and your script somehow errors which stops the part from getting resized or you are not resizing it at all, you are only resizing NewWood.WoodSection imKirda 4491 — 2y
0
NewWood is a model and WoodSection is the actual part. Should've included that in the post HPermCuber 10 — 2y
View all comments (2 more)
0
add "print(NewWood.WoodSection.Size)" before setting the size and after setting the size of the part, see if it prints someething at all and what values if so imKirda 4491 — 2y
0
It printed "1, 1, 1" and then "1, 0.0010000000474975, 1" HPermCuber 10 — 2y

Answer this question