soooo i am making a roblox horror game and i have made a script.
the script is suposed to run a local script after being clicked...
but the local script wont run after watching many tutorials on youtube.
please help me.
i really want to finish my game
ALL CODE USED:
USES REMOTE EVENTS
if clicked normal script{
local RS = game:GetService("ReplicatedStorage") local ButtonClicked = RS:WaitForChild("PlayButtonShow") function Clicked(Player) local button = script.Parent.PlayButton:Clone() button.Parent = Player.PlayerGui ButtonClicked:FireClient() end script.Parent.ClickDetector.MouseClick:Connect(Clicked)
}
local script{
local RS = game:GetService("ReplicatedStorage") local ButtonClicked = RS:WaitForChild("PlayButtonShow") function Run() game.StarterPlayer.CameraMaxZoomDistance = 10 game.StarterPlayer.CameraMinZoomDistance = 10 end ButtonClicked.OnClientFunction:Connect(Run)
}
The problem is that you are changing the StarterPlayer CameraMaxZoomDistance and CameraMinZoomDistance.
You need to change the LocalPlayers CameraMaxZoomDistance and CameraMidZoomDistance.
Otherwise, you will not notice a change.
A few problems here
local RS = game:GetService("ReplicatedStorage") local ButtonClicked = RS:WaitForChild("PlayButtonShow") function Clicked(Player) local button = script.Parent.PlayButton:Clone() button.Parent = Player.PlayerGui ButtonClicked:FireClient(Player) -- You weren't being specific on what client you want to fire. end script.Parent.ClickDetector.MouseClick:Connect(Clicked)
Local script:
local RS = game:GetService("ReplicatedStorage") local ButtonClicked = RS:WaitForChild("PlayButtonShow") local player = game.Players.LocalPlayer -- Get the localplayer function Run() player.CameraMaxZoomDistance = 10 -- Replace StarterPlayer with the player player.CameraMinZoomDistance = 10 end ButtonClicked.OnClientEvent:Connect(Run) -- I am sure it is suppose to be OnClientEvent...