#script to local script help!

77 messages · Page 1 of 1 (latest)

outer ocean
#

how would i make this into a local script?

local RS = game:GetService("ReplicatedStorage")
local itemsFolder = RS
local proximityPrompt = game.Workspace.ZombieNPCSmall.Head.ProximityPrompt

proximityPrompt.Triggered:Connect(function(player)

    local name = "Zombie Key"
    local tool = itemsFolder[name]:Clone()
    tool.Parent = player.Character
    game.Workspace.ZombieNPCSmall:destroy()
end)
dusty burrow
#

depends on what you want to achieve

#

It should already work if you put it in a local script

outer ocean
#

it doesnt

dusty burrow
#

oh my bad

#

proximityPromt .triggered doesn’t work on client side

#

so you would need to use remoteEvents

outer ocean
#

ah

outer ocean
#

how would i do that?

#

like i want the npc to :destroy() only for the player that used the proximityprompt (gonna shorten this to prpo)

outer ocean
dusty burrow
#

you know how remotrevents work?

outer ocean
#

sorta

#

(not really)

dusty burrow
#

it’s a thing

#

which you can fire from either the client or server

#

and in your case you will fire it from the server

outer ocean
dusty burrow
#

and then a localscript will be listening to that remoteevent and when it fires you can run some code on the client

dusty burrow
#

because knowing how those work is really important

outer ocean
#

oh

#

ok :))

dusty burrow
#

Look if you can figure it out and otherwise i’m here to help

outer ocean
#

ok

outer ocean
#

how would i make it after this?

also would this work?

#

also forgot to call the function

#

I DONT UNDERTSNAD IT

#

WHY IS IT WORKING ON THE SERVER AND NOT ON THE CLIENT IN THIS VIDEO

silver remnant
#

why is player global

outer ocean
#

idk how any of this remoteevent stuff works

outer ocean
silver remnant
silver remnant
outer ocean
#
local RS = game:GetService("ReplicatedStorage")
local itemsFolder = RS
local prpo = game.Workspace.ZombieNPCSmall.Head.ProximityPrompt

prpo.Triggered:Connect(function(player)

    local name = "Zombie Key"
    local tool = itemsFolder[name]:Clone()
    tool.Parent = game.player.Character
    game.Workspace.ZombieNPCSmall:destroy()
end)

this is the code now

silver remnant
#

put

#

what exactly are you tying to make?

nova pendant
outer ocean
#

there is a part with a proximityprompt (prpo) in it

when the player uses the prpo, they get a tool that's found in replicatedstorage

then the part disappears/ :destroy()

this should only happen to the person that used the prpo

nova pendant
#

it should only disappear for one person?

#

this part of your code is nonsense

#

also :Destroy() should be capital

#

and game.Workspace you can just replace with workspace

outer ocean
trim terrace
#

remove game. you already have the player

feral summitBOT
#

studio** You are now Level 10! **studio

nova pendant
#

what do you mean by for one person

outer ocean
#

so the part disappears for only the person that used the prpo

trim terrace
silver remnant
feral summitBOT
#

studio** You are now Level 8! **studio

outer ocean
#

yeah it’s in a local script but doesn’t work

feral summitBOT
#

studio** You are now Level 5! **studio

silver remnant
#

ur script is a descendant of workspace probably

outer ocean
#

someone else said that .Triggered doesn’t work in locals

outer ocean
trim terrace
# silver remnant

yes but he cant give the tool with local script (I mean he technically can, but it will be clint only)

outer ocean
#

should it be in sss

silver remnant
outer ocean
#

rs?

silver remnant
#

yes that would work

outer ocean
#

sps?

silver remnant
trim terrace
#

on server, deleting the part for 1 person is impossible, on client giving a tool is impossible wont work propperly

silver remnant
#

oh

#

interesting

nova pendant
#

yeah it would need to be a local script to remove just for one player

outer ocean
#

so the script is impossible in a local?

silver remnant
#

no it’s impossible as a server script

outer ocean
#
local RS = game:GetService("ReplicatedStorage")
local itemsFolder = RS
local prpo = game.Workspace.ZombieNPCSmall.Head.ProximityPrompt

prpo.Triggered:Connect(function(player)
    local name = "Zombie Key"
    local tool = itemsFolder[name]:Clone()
    tool.Parent = game.Players.LocalPlayer.Character
    game.Workspace.ZombieNPCSmall:Destroy()
end)
#

would this work?