Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Accessory giver gui script doesn't work. Any idea what is worng with this code?

Asked by 5 years ago

Hello everyone, i have a small problem with my script. Basically the main function of this script is to give a custom accessory to a player via gui button, i'm pretty sure that i made some mistakes when i was writing this code. (Btw I'm pretty new in scripting, before i was just building/3D modeling in blender, roblox sudio so thanks for any help)

local playerModel = game.Players.LocalPlayer.Character
local humanoid = playerModel:WaitForChild("Humanoid")

script.Parent.MouseButton1Click:Connect(function()

print ("Works-1")
if humanoid then
humanoid:AddAccessory(game.ReplicatedStorage.DarkWings)
print ("Works-2")
end
end)
0
replace humanoid:AddAccessory with playerModel:AddAccessory the humanoid doesnt hold the accessories but the character does Gameplayer365247v2 1055 — 5y
0
also instead of addaccessory u should parent the darkwings to the character (dont know if that works better though) Gameplayer365247v2 1055 — 5y
0
There is still a problem, in console it says that "AddAccessory is not a valid member of Model" 13kapi13 4 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

You should actually better insert the Accessory in the Character also I made a script for you:

local playerModel = game.Players.LocalPlayer
local Character = workspace:FindFirstChild(playerModel.Name)
script.Parent.MouseButton1Click:Connect(function()
if Character:FindFirstChild("Humanoid") then
game.ReplicatedSTorage.DarkWings:Clone().Parent = Character
end
end)

Also remember only the client will see the wings!

0
Hey, your script works fine. I've just added attachment code to this script, but is it possible to create or change a script that will allow other players to see this accessory? 13kapi13 4 — 5y
Ad

Answer this question