I'm making an Avengers Simulator game and when they select iron man i want it to change their pants and shirt and add a helmet accessory to their head.
When I click the button this error comes:- Pants is not a valid member of Player "Players.KiaansGTA"
These are my scripts:-
Script for the button
-- Variables
local Button = script.Parent
local Player = game.Players.LocalPlayer.Character
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage.IronMan.SuitUp
function OnClick()
RemoteEvent:FireServer(Player)
end
Button.MouseButton1Down:Connect(OnClick)
Server Script
-- Variables
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage.IronMan.SuitUp
local Suit = ServerStorage.IronMan.Suit
local Pants = Suit.Pants.Value
local Shirt = Suit.Shirt.Value
function SuitUp(Player)
Player.Pants.PantsTemplate = ("rbxassetid://".. Pants)
Player.Shirt.ShirtTemplate = ("rbxassetid://".. Shirt)
end
RemoteEvent.OnServerEvent:Connect(SuitUp)
And could someone pls copy paste this and put on the official roblox dev page for me? I'm under 13
