im making a sort ball game and i need the size to be working, only its not working.
I tried making it a local script a serversided script and even asking friends and people i know.
Nothing worked and no one knew why.
So i have a ball, and that ball size is: 5.75, 5.75, 5.75.
Everytime i weld the ball to the player the ball changes size to match the players size, so instead of being 5.75, 5.75, 5.75 its something else
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(Char)
local Ball = game.ReplicatedStorage:WaitForChild("Ball"):Clone()
local Weld = Instance.new("Weld")
Weld.Parent = Char
Weld.Part0 = Ball
Weld.Part1 = Char:WaitForChild("HumanoidRootPart")
Ball.Position = Char.PrimaryPart.Position
Ball.Parent = Char
Ball.Size = Vector3.new(5.75, 5.75, 5.75)
local humanoid = Char:WaitForChild("Humanoid")
humanoid.Sit = true
if Char then
for _, part in pairs(Char:GetDescendants()) do
if part:IsA("MeshPart") then
part.Transparency = 1
end
end
end
end)
end)
let me know if you know what the problem is, i really appreciate it.
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(Char)
local Ball = game.ReplicatedStorage:WaitForChild("Ball"):Clone()
local Weld = Instance.new("Weld")
Weld.Parent = Char
Weld.Part0 = Ball
Weld.Part1 = Char:WaitForChild("HumanoidRootPart")
Ball.Size = Vector3.new(1, 1, 1)
Ball.Position = Char.PrimaryPart.Position
Ball.Parent = Char
Ball.Size = Vector3.new(5.75, 5.75, 5.75)
local humanoid = Char:WaitForChild("Humanoid")
humanoid.Sit = true
if Char then
for _, part in pairs(Char:GetDescendants()) do
if part:IsA("MeshPart") then
part.Transparency = 1
end
end
end
end)
end)
You could try reparenting to the character once the character has fully loaded. I donât think there is a built in event for this but a simple âwait()â might be just long enough.
I amended your code slightly, I havenât checked it fully but added the lines
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(Char)
local Ball = game.ReplicatedStorage:WaitForChild("Ball"):Clone()
local Weld = Instance.new("Weld")
Weld.Parent = Char
Weld.Part0 = Ball
Weld.Part1 = Char:WaitForChild("HumanoidRootPart")
Ball.Position = Char.PrimaryPart.Position
Ball.Parent = workspace --changed parent to workspace
Ball.Size = Vector3.new(5.75, 5.75, 5.75)
local humanoid = Char:WaitForChild("Humanoid")
humanoid.Sit = true
if Char then
for _, part in pairs(Char:GetDescendants()) do
if part:IsA("MeshPart") then
part.Transparency = 1
end
end
end
task.wait(1) --added wait here
Ball.Parent = char --added parent change here
end)
end)
What size of the ball when you enter the game? If it not 5.75, 5.75, 5.75 then try this code
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(Char)
local Ball = game.ReplicatedStorage:WaitForChild("Ball"):Clone()
local Weld = Instance.new("Weld")
Weld.Parent = Char
Weld.Part0 = Ball
Weld.Part1 = Char:WaitForChild("HumanoidRootPart")
Ball.Size = Vector3.new(5.75, 5.75, 5.75)
Ball.Position = Char.PrimaryPart.Position
Ball.Parent = Char
task.spawn(function()
game:GetService('RunService').Heartbeat:Connect(function()
Ball.Size = Vector3.new(5.75, 5.75, 5.75)
end)
end)
local humanoid = Char:WaitForChild("Humanoid")
humanoid.Sit = true
if Char then
for _, part in pairs(Char:GetDescendants()) do
if part:IsA("MeshPart") then
part.Transparency = 1
end
end
end
end)
end)