This is the server script in Serverscriptservice
game.Players.PlayerAdded:connect(function(player) local event = Instance.new("RemoteEvent") event.Name = "ChangePlotPositionEvent" event.Parent = player event:FireServer() end)
and this is the local script in starter playerscripts
game.Players.LocalPlayer:WaitForChild("ChangePlotPositionEvent").OnClientEvent:connect(function(player) print("PlayerAdded") local Lastplot = game.ReplicatedStorage:WaitForChild("LastPlot") local GameValues = Instance.new("Folder",player) GameValues.Name = "GameValues" local Plot = Instance.new("IntValue",GameValues) Plot.Name = "Plot" Plot.Value = Lastplot.Value + 1 game.ReplicatedStorage.RemoteFunctions.Plot.ChangePlotPositionEvent:FireServer(Plot) local PlotClone = game.ReplicatedStorage.newbase:Clone() PlotClone.Parent = game.Workspace PlotClone.Name = player.Name.."'s Plot" PlotClone.CFrame = CFrame.new(Vector3.new(-138.5, -18.5+Plot.Value* 50,178)) end)
No Errors. Just not working
I'm a bit confused, but if you're doing what I think you're doing, then this will help.
My assumption is that you're trying to fire the RemoteEvent that you just made; however, instead of using FireClient
you're using FireServer
. When you use FireServer
, it sends an event intended for server-scripts. Also, FireClient
requires a player in order to fire the client, without it the server would have no idea which client to tell what to do.
game.Players.PlayerAdded:connect(function(player) local event = Instance.new("RemoteEvent") event.Name = "ChangePlotPositionEvent" event.Parent = player event:FireClient(player) end)
game.Players.LocalPlayer:WaitForChild("ChangePlotPositionEvent").OnClientEvent:connect(function() print("PlayerAdded") local Lastplot = game.ReplicatedStorage:WaitForChild("LastPlot") local GameValues = Instance.new("Folder", game.Players.LocalPlayer) --Need to move GameValues.Name = "GameValues" --Need to move local Plot = Instance.new("IntValue",GameValues) --Need to move Plot.Name = "Plot"--Need to move Plot.Value = Lastplot.Value + 1--Need to move game.ReplicatedStorage.RemoteFunctions.Plot.ChangePlotPositionEvent:FireServer(Plot) local PlotClone = game.ReplicatedStorage.newbase:Clone()--Need to move PlotClone.Parent = game.Workspace--Need to move PlotClone.Name = player.Name.."'s Plot"--Need to move PlotClone.CFrame = CFrame.new(Vector3.new(-138.5, -18.5+Plot.Value* 50,178))--Need to move end)
Also, incase you're unaware, FilteringEnabled
prevents any creation from the client. In otherwords, you need to move all forms of creation, whether it be values, parts, etc., to the server.
FilteringEnabled
isn't that bad once you get used to it, and can be extremely helpful. Think of it like riding a bike, it's hard because you don't know what does what, but after awhile, you start to push the pedals and move the bike.
ALSO:
Don't test in the Roblox Studio test mode, as FilteringEnabled
is pointless for it. Instead click the "Test" tab and then click the Start with the icon of the Servers above it.