-
What do you want to achieve?
I would like a model/NPC (name of Looter) to spawn near the player when the remote event is fired -
What is the issue?
This keeps popping up in the Output even though I didn’t transfer the parameter of Player -
What solutions have you tried so far?
I changed it into HumanoidRootPart, Head and other parts of the character
-- Localscript
local looterevent = game.ReplicatedStorage.LooterEvent
local button = script.Parent
local gui = script.Parent.Parent.Parent
local quest = game.ReplicatedStorage.chosenquest
local questlist = game.Players.LocalPlayer.PlayerGui.ScreenGui.ScrollingFrame
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
button.MouseButton1Click:Connect(function()
local root = char:WaitForChild("Torso")
gui:Destroy()
local Q1 = quest:Clone()
Q1.Parent = questlist
looterevent:FireServer(root)
end)
--------------------------------
-- Server script
local looterevent = game.ReplicatedStorage.LooterEvent
local looter = game.ReplicatedStorage.looter
looterevent.onServerEvent:Connect(function(root)
local newlooter = looter:Clone()
newlooter.Parent = workspace
newlooter.PrimaryPart.CFrame = root.CFrame * CFrame.new(0,0,-5)
end)