Hi when i FireServer(player, equip) and then on my server script i print (player, equip),It just says my username twice.
LOCAL SCRIPT
local ItemFrame = script.Parent.Frame.ScrollingFrame
local Trail = game.ReplicatedStorage["RainbowTrail"] -- Don't Put Serverstorage as client can't access serverstorage
wait(player.Character:WaitForChild("HumanoidRootPart"))
local success, hasPass = pcall(function() -- Changing the pcall to the correct format
return MarketPlaceService:UserOwnsGamePassAsync(player.UserId, RainbowpassID)
end)
if success then -- Checking if successful
if hasPass then
local clone = script.Parent.Frame.ScrollingFrame.TrailSample:Clone()
clone.ImageLabel.Image = "http://www.roblox.com/asset/?id="..10939695942
clone.Parent = script.Parent.Frame.ScrollingFrame
clone.Visible = true
clone.Equipped.Visible = false
local equip = clone.Equip
equip.MouseButton1Click:Connect(function(equipped)
equip.Name = "RainbowTrail"
game.ReplicatedStorage.EquipTrail:FireServer(player, equip)
end)
print("Playerhaspass")
end
end
You don’t have to send the player instance when calling FireServer() but if your intention is to pass another player and not the client calling it then just add another value in the OnServerEvent
local clone = script.Parent.Frame.ScrollingFrame.TrailSample:Clone()
clone.ImageLabel.Image = "http://www.roblox.com/asset/?id="..10939695942
clone.Parent = script.Parent.Frame.ScrollingFrame
clone.Visible = true
clone.Equipped.Visible = false
local equip = clone.Equip
Suggests that equip is parented to a UI element. If that’s the case, the server can’t see a UI element that is only on the client. The client is sending the server an object that does not exist on the server, hence the nil in the print.