What do you want to achieve? I want to get a local player instance from serverside using module scripts
What is the issue? I cannot get a player object because it was a server side script
What solutions have you tried so far? before sending a client to server (which is a server module scripts) i put a localplayer variable and try sending it to it but some how the result is nil
So just conclusion, Im making a placement system with a prompt that a owner of that plot can use it, i tried to debug first so i dont need to waste my time deleting all codes by printing hello world if the plot owner has triggered it. But when i tested, it doesnt work. I used objectvalue to determined that the player is a plot owner or not. And yes you can guess that the value of the objectvalue is empty so the script doesnt print out the result.On the client is working fine because you can get the localplayer but when you transfer to a server(module script), it appears to be nil
NOTE: i learn from a tutorial inside a forum because im not good at remote functions that much so it was hard for me
yes this will work indeed. But whatever is in that piece of script will execute when the player is added. What if you want to just have a variable? I think that’s what he means. If not than sorry I am curious myself in knowing is it actually possible to make a variable in a script that references the localPlayer without having to make a connection and put player in the brackets as a parameter.
How do you currently know which plot belongs to which user. Do you automatically give a user a plot when they join your game.
Or do they touch a part on the plot to claim it
Or something else?
> function Placement:Place(model, cf, isColliding, player)
> if (not isColliding and isServer) then
> local clone = model:Clone()
> local owner = clone:FindFirstChild("Owner")
> print("Getting owner data")
> clone:SetPrimaryPartCFrame(cf)
> clone.Parent = self.CanvasObjects
> for i,v in pairs(clone:GetDescendants()) do
> print("Name:"..v.Name.." ClassName:"..v.ClassName)
> if v.Name == "Owner" and v.ClassName == "ObjectValue" then
> print("Found a owner objectvalue!")
> end
> end
> print(player)
> game.Workspace.TestDebug.Value = clone
> end
>
> if (not isServer) then
> invokePlacement:FireServer("Place", model, cf, isColliding)
> end
> end
model is the model of the placement,cf is the cframe of the position and rotation, is collide is an another function that checks if the object is collide with other object, and last a
player which are from my local script that sends a data to a module which results in a NIL
I did a object value on every plot, so if players join i can set the plot value to the player, however if im putting the placement into a plot, then it will bug a lot.So,i prefer make a new storage.