#why is my scripting saying it expects an string?
1 messages · Page 1 of 1 (latest)
** You are now Level 11! **
im not reading all of this code but
its probably because it expects a string
and what youre sending is not a string
i wanna make that
print typeof(thing)
and see what it shows you
it is nil.
ok wait
what is this. script.Parent.Parent.Parent.Parent
and you are not sending over player
you arent sending anything
then remove o from the arguments.
.
and instead of doing local plr =game.Players:WaitForChild(plr) do
local Player = game.Players:GetPlayerFromCharacter(character)
aight
i realized that the plr is the fire without the o,
i should check before asking
but anyways
after clicking
no errors show up nor the character on workspace but do appear on the player's character
yes
but you need to account for it in the OnSererEvent
the first argument will be the player
oh
for ones who want to keep there eyes: |
Server:
game.ReplicatedStorage.addchar.OnServerEvent:Connect(function(o, plr)
tostring(plr) -- why ?
local plr = game.Players:WaitForChild(plr) -- plr is already here my guy
local character = game.ReplicatedStorage.Rig:Clone()
character.Parent = workspace
plr.Character = character
end)
Client:
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.addchar:FireServer(script.Parent.Parent.Parent.Parent) -- the parent parent ye
end)
Just do:
game.ReplicatedStorage.addchar.OnServerEvent:Connect(function(player: Player)
local character = game.ReplicatedStorage.Rig:Clone()
character.Parent = workspace
player.Character = character
end)
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.addchar:FireServer()
end)
** You are now Level 2! **
hum btw you will need to change player camera in client and other things so you should use a bindable function to get back to the client the new character so you can change the camera and other things
the rig doesnt parent to workspace
hum it should.. (or i can be wrong but i dont see why)
add a print to the server thing to check if its executed