I created a script that is supposed to increase your size/scale when activated, but it doesn’t seem to be working for some reason. I’m not sure what the issue is, could you please help me with the script
and, its a Local Script!
Local Script:
local twix = script.Parent
local ScaleFactor = 5
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local Deb = false
local Activated = false
local humanoid = char:FindFirstChild("Humanoid")
local BodyHeight = humanoid.BodyHeightScale.Value
local BodyWidth = humanoid.BodyWidthScale.Value
local BodyDepth = humanoid.BodyDepthScale.Value
local HeadScale = humanoid.HeadScale.Value
twix.Activated:Connect(function()
if not Activated and not Deb then
Activated = true
Deb = true
BodyHeight = BodyHeight + ScaleFactor
BodyWidth = BodyWidth + ScaleFactor
BodyDepth = BodyDepth + ScaleFactor
HeadScale = HeadScale + ScaleFactor
end
task.wait(0.5)
Activated = false
Deb = false
end)
There’s probably a better way to achieve this, but if you need to do this in a LocalScript, re-parent the character to the workspace after the changes and it’ll trigger the new scaling.
char.Parent = nil
char.Parent = workspace
You can also do this directly in a ServerScript and it would work as you tried, if you want the changes to replicate to other players.
This is just a snippet of code so it’s difficult to know the context but I altered what you pasted:
local twix = script.Parent
local ScaleFactor = 5
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local Activated = false
local humanoid = char:WaitForChild("Humanoid")
twix.Activated:Connect(function()
if not Activated then
Activated = true
humanoid.BodyHeightScale.Value += ScaleFactor
humanoid.BodyWidthScale.Value += ScaleFactor
humanoid.BodyDepthScale.Value += ScaleFactor
humanoid.HeadScale.Value += ScaleFactor
char.Parent = nil
char.Parent = workspace
task.delay(0.5, function() Activated = false end)
end
end)
Try changing FindFirstChild("Humanoid") to WaitForChild("Humanoid"). As this script appears to be inside a backpack, it’s probably running before the character has fully loaded.
but, one more thing it works but it only works like one time it only gets one time big, i want it so evertime its been activated you will get big not only one time
This code looks like its only programmed to work one time. You have do something in a while loop or trigger an event. The way it looks right now it will run one time and that’s it. You could use a mouse button trigger, attach huminoid part trigger like .hit.