How my code is supposed to work is a hat is cloned and the handle’s size is changed to match the player’s size. Here is my current code:
if state == "Unequip" then
hat.Value = false
elseif state == "Equip" then
hat.Value = true
local clone = game.ServerStorage:WaitForChild("Hats"):WaitForChild(hat.Name):Clone()
clone.Name = hat.Name
clone.Handle.Size = player.Size.Value
local object = Instance.new("ObjectValue",hat)
object.Name = "Object"
object.Value = clone
repeat wait() until game.Workspace:FindFirstChild(player.Name)
local char = game.Workspace:WaitForChild(player.Name)
However, when the hat is given to the player, it stays the same size as it was in the hats folder.
I’ve attempted to use X, Y, and Z values, which ended up giving me the error 'Cannot assign X to ’ and using
Vector3.new(player.Size.Value.X, etc. etc.)
This is gonna sound very simple, but maybe try to resize the mesh inside the hat instead of the hat itself.
Resizing meshes only works on MeshParts, not parts with meshes in them, that’s different.
clone.Handle.Mesh.Scale = player.Size.Value
clone.Handle.Size = player.Size.Value.
Edit: Also, since meshes sometimes have weird sizes/offsets, you may want to multiply the size and offset instead of manually setting them to avoid awkwardly positioned or stretched out/compressed hats.
I’m not using a mesh inside a part. I’m using a MeshPart.
It’s been a day and you still haven’t responded, is everything alright?
Ye just a bit busy at times.
I need to know a few things here, from or in what kind of script is it done?
If it’s a local script, it may not replicate very well.
It could also possibly be the player size value, maybe it doesn’t change or the value might be too small.
Wrong value I also see as an option, to what object does “player.Size” refer?
(Apologies for typing errors or something, typed from an mobile device and it’s 5 AM here or so, got notified at midnight.)
It is a ModuleScript.
player.Size is a Vector3 value created from the server which is updated when the character’s size is updated. Both the player.Size and the character’s size increase by increments of 0.1 on each axis. The goal is that when the accessory is given to the character, the size is updated so it matches the character’s size.
It seems to change size fine when changed in the increments, however, when the player resets and the hat is re-equipped, it remains the default size.
Doesn’t Roblox have an auto-rescale system for R15? You could use that one instead of writing your own.
Seeing the answers to my last question, I’m kind of confused a little bit myself since I don’t see a lot wrong with this.
Mind providing a place file with the script and accessory you are trying to resize? Perhaps I could take a deeper look at it and see what is going on.
The characters are forced into R6 due to the way my game works.
Let me know if this link doesn’t work slime sim.rbxl
Everything is in HatModule (ServerScriptService)
and the hats folder (ServerStorage)
Alright, I’ll take a look at it after restarting.
The game seems to be working alright for me, the hats resize, just be very small increments.
Perhaps provide a screenshot of it not working?
Add some prints to your code that print values so you can make sure values are changed and updated properly.
That’s not the problem. It’s when the hat is re-equipped after resetting,
Do you re-reference it after re-equipping?
Could be that you’re trying to resize a hat that doesn’t exist anymore but because it’s still in memory and doesn’t get cleared the script still tries to resize it.
I suppose I could try that. From my knowledge it is stored as an object but I could very well be wrong.