I’m having a problem with adding the player UserId in the IntValue
When the model is cloned into the workspace I want to add the players Id in the IntValue so it the button can delete the player’s Wagon only not anyone else’s wagon
The Script is in a regular script
local ServerStorage = game:GetService("ServerStorage")
local wagon = ServerStorage.Wagons.HermesWagonInHB1
local deb = script.Parent.Parent.Parent.Parent.deb
script.Parent.MouseButton1Click:Connect(function()
if deb.Value == false then
wait(.2)
wagon:Clone().Parent = game.Workspace
wagon:Clone().User.Value = script.Parent.Parent.Parent.Parent.Parent.Parent.UserId
deb.Value = true
elseif deb.Value == true then
wait(.2)
game.Workspace:FindFirstChild("HermesWagonInHB1"):Destroy()
deb.Value = false
end
end)
local wagon = game.ServerStorage.Wagons.HermesWagonInHB1
local deb = script.Parent.Parent.Parent.Parent.deb
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
if deb.Value == false then
wait(.2)
wagon:Clone().User.Value = player.UserId
wagon:Clone().Parent = game.Workspace
deb.Value = true
elseif deb.Value == true then
wait(.2)
game.Workspace:FindFirstChild("HermesWagonInHB1"):Destroy()
deb.Value = false
end
end)
22:32:48.194 Wagons is not a valid member of ServerStorage "ServerStorage" - Client - LocalScript:2