so i have this script which randomizes the player height everytime you join, what i want it to do is: when you touch the part your: height, width and depth randomize everytime you touch the brick.
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild('Humanoid')
for i,Child in pairs(Humanoid:GetChildren()) do
if Child:IsA('NumberValue')then
if Child.Name == 'BodyHeightScale'then
Child.Value = math.random (1,5)
end
if Child.Name == 'BodyWidthScale' then
Child.Value = math.random(1,2)
end
end
if Child.Name == 'BodyDepthScale' then
Child.Value = math.random(2)
end
if Child.Name == 'HeadScale' then
Child.Value = math.random (3)
end
end
end)
end)
local debounce = false
part.Touched:Connect(function(hit)
if not debounce and hit.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent.Humanoid.Health > 0 then
debounce = true
--// Code here
wait(COOLDOWNTIMEHERE)
debounce = false
end
end)
part is a part that will be touched. You can define this wherever you would like.
However, if you don’t understand part-touch logic, I can assume you didn’t completely produce the OP code, or you don’t understand why it works.
When it comes to coding, you have to know the “how, what, why, when, and where” of code bits. This means that rather that aimlessly writing code without knowing it’s potential in another project, try to understand bits of it for later usage. This is how many people learn Lua/Roblox and it will make your life much easier.
yea i didnt really make it since i cant script. the site says i cant have people make scripts fully for me so i post here what i am able to find online.
nope nothing, but the script im using has some extra scripts ill send those: inside of the original script i send there are three more: (the thing wrong with this script is that i dont want it to only change the height but also randomize the depth width and height so you could get some weird creatures from this.
Game.Players.PlayerAdded : then hold true Current "Height" function
end
if plr spawn then hold true when ("Reset").save.child.Height
function
end
then.child.("BodyWith") if.plr spawn then hold true.that.plr.stays "Height"
then.child.spawns.then.hold.true.current."Height".then.if.plr.reset.spawn
same."Height" = "Same Folder,)
end
end
end
game.Players.PlayerAdded:Connect then hold true Current "Height" function
end
if plr spawn then hold true when ("Reset").save.child.Height
function
end
then.child.("HeadScale") if.plr spawn then hold true.that.plr.stays "Height"
then.child.spawns.then.hold.true.current."Height".then.if.plr.reset.spawn
same."Height" = "Same Folder,"
end
end
end
if Torso.Left Leg.Left Arm.Right Leg.Right Arm = random then if plr spawn in then
function then save -- This saves Current Height
end end
and inside of the part the original script is in theres another script:
You should only need the information @iGottic has given you to make a working script.
However since you’re still stuck:
local Part = ... --// Part they need to touch
local Debounce = false
local function RandomizeSize(hit) --// Change size of character who touches the block
if (Debounce == false) then --// Don't let the RandomizeSize function be called too many times in a second.
Debounce = true
local Character = hit.Parent --// Get the parent of `hit`
local Humanoid = Character:FindFirstChild("Humanoid") --// Get a Humanoid from Character if one does exist
if (Humanoid) then --// Make sure Humanoid exists
--// Change the size of character
Humanoid.BodyHeightScale.Value = math.random(1, 5)
Humanoid.BodyWidthScale.Value = math.random(1, 2)
Humanoid.BodyDepthScale.Value = math.random(1, 2)
Humanoid.HeadScale.Value = math.random(1, 3)
end
wait(1) --// RandomizeSize can only be "activated" every second
Debounce = false
end
end
Part.Touched:Connect(RandomizeSize) --// :Connect the RandomizeSize function to the .Touched signal
Here are some resources if you don’t understand the code:
i changed the part i need to touch to the partname or does it need to be the path because theres an orange stripe under it, also at the random numbers with the (1, 5) is that that it goes from 1 to 5 and can change in 1 2 3 4 5 and choose random from that?
that worked! also another question regarding this site and not this script, ive posted another thread the same time as this and i wonder what the maximum wait time is normally since ive never been waiting this long for a first response (and that script i didnt get off the internet its made by my scripter of the game but he cant work this weekend so thats why im trying to ask this site to finish it)
when its (1, 1) it doesnt change a bit but when its (0.9, 1) the character becomes super thin, how does 0.1 be such a big difference? edit: currently at (0.99, 1) and it becomes like this
i basically just want it to become a different shape but not a bigger shape because the game is about growing and otherwise it would defeat the purpose, i only want it to become smaller but not as small as the picture
When you’re randomizing a decimal number and 1, it’s basically the same as randomizing 0 and 1. I don’t know all the specifics but this page may help: math | Documentation - Roblox Creator Hub (Scroll down to random.)
However, if you do this:
local generate = math.random(1, 100)
height = generate / 100