Im trying to make a Gui button that changes a players image.
But I keep on getting a Error saying .
I’ve tried to change the coding and also looked for other forums.
here is the coding.
Oh and I suck at coding.
Im trying to make a Gui button that changes a players image.
But I keep on getting a Error saying .
I’ve tried to change the coding and also looked for other forums.
here is the coding.
Oh and I suck at coding.
You accidentally did:
lcoal sam = handle.Torso..
So you’re trying to reach Torso
twice.
Try this:
local character = plr.Character or plr.CharacterAdded:Wait()
local handle = character.Torso
local sam = handle.SamPostAttachment.SamGui.Sam.Image
I assume the other stuff work properly
on top of indexing torso twice, you localize an image that you can’t change so it will error there too
local Image = script.Parent
local Gui = Image.TextButton
local plr = game:GetService("Players").LocalPlayer
local handle = plr.Character:WaitForChild("Torso",10)
local sam = handle.SamPosAttachment.SamGui.Sam
while task.wait(1) do
sam.Image = "rbxassetid://9591330149"
end
Worth mentioning that even with the provided fixes this script will only be compatible with R6 avatars, R15 avatars do not contain a “Torso” limb, it is split into two parts “UpperTorso” and “LowerTorso”.
As @Forummer said, to maintain compatibility with R15, it would be a good idea to switch to character.HumanoidRootPart
. All varieties of avatar have those.